﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using WPFExcelReport.Helpers;
using System.Windows.Controls;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TABGS08 : ViewBase
    { 

        public TABGS08()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            MV = new VGASTGA();
            this.DataContext = MV;
            InitializeComponent();
        } 
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            base.Window_Loaded(sender, e);
        }
         
        public void Load()
        {
           
        }
        public override void OnEXAUFChg(string vlaue)
        {
            if (EXAUF.Length < 20)
                return;
            dwData = TBMain.NewRow();
            dwData["GAGMANDANT"] = app.Mandant;
            dwData["GAGART"] = EXAUF.Substring(1, 20);
            dwData["GAGVAR"] = EXAUF.Substring(21, 3);
            dwData["GAGFARBE"] = EXAUF.Substring(24, 10);
            SResult = ((VGASTGA)MV).QueryGASTGA(dwData, 4);
            MergeData(SResult);
            base.OnEXAUFChg(vlaue);
        }

        public override void SaveCommand(object sender, RoutedEventArgs e)
        { 
            foreach (DataRow row in TBMain.Rows)
            {
                ((VGASTGA)MV).UpdateGASTGA(row, app.company,0);
            }
            base.SaveCommand(sender, e);
        }
    }
}
